<template>
  <div>
    <div class="hmtop">
      <!--顶部导航条 -->
      <div class="am-container header">
        <ul class="message-l">
          <div class="topMessage">
            <div class="menu-hd">
              <a href="#" target="_top" class="h">亲，请登录</a>
              <a href="#" target="_top">免费注册</a>
            </div>
          </div>
        </ul>
        <ul class="message-r">
          <div class="topMessage home">
            <div class="menu-hd"><a href="#" target="_top" class="h">商城首页</a></div>
          </div>
          <div class="topMessage my-shangcheng">
            <div class="menu-hd MyShangcheng"><a href="#" target="_top"><i class="am-icon-user am-icon-fw"></i>个人中心</a>
            </div>
          </div>
          <div class="topMessage mini-cart">
            <div class="menu-hd"><a id="mc-menu-hd" href="shopcart.html" target="_top"><i
                class="am-icon-shopping-cart  am-icon-fw"></i><span>购物车</span><strong id="J_MiniCartNum"
                                                                                      class="h">0</strong></a>
            </div>
          </div>
          <div class="topMessage favorite">
            <div class="menu-hd"><a href="#" target="_top"><i class="am-icon-heart am-icon-fw"></i><span>收藏夹</span></a></div>
          </div>
        </ul>
      </div>

      <!--悬浮搜索框-->

      <div class="nav white">

        <div class="logoBig">
          <img src="static/images/logo.png" style="margin-left: 0px">
        </div>

        <div class="search-bar pr">
          <a name="index_none_header_sysc" href="#"></a>
          <form action="search.html">
            <input id="searchInput" name="index_none_header_sysc" type="text" placeholder="搜索" autocomplete="off">
            <input id="ai-topsearch" class="submit am-btn" value="搜索" index="1" type="submit">
          </form>
        </div>
      </div>

      <div class="clear"></div>
    </div>
    <div class="banner">
      <!--轮播 -->
      <div class="am-slider am-slider-default scoll" data-am-flexslider id="demo-slider-0">
        <ul class="am-slides">
          <li class="banner1"><a href="introduction.html"><img src="../assets/images/ad1.jpg"/></a></li>
          <li class="banner2"><a><img src="../assets/images/ad2.jpg"/></a></li>
          <li class="banner3"><a><img src="../assets/images/ad3.jpg"/></a></li>
          <li class="banner4"><a><img src="../assets/images/ad4.jpg"/></a></li>
        </ul>
      </div>
      <div class="clear"></div>
    </div>
    <div class="shopNav">
      <div class="slideall">

        <div class="long-title"><span class="all-goods">全部分类</span></div>
        <div class="nav-cont">
          <ul>
            <li class="index"><a href="#">首页</a></li>
            <li class="qc"><a href="#">闪购</a></li>
            <li class="qc"><a href="#">限时抢</a></li>
            <li class="qc"><a href="#">团购</a></li>
            <li class="qc last"><a href="#">大包装</a></li>
          </ul>
          <div class="nav-extra">
            <i class="am-icon-user-secret am-icon-md nav-user"></i><b></b>
              <router-link to="/test">我的福利</router-link>
            <i class="am-icon-angle-right" style="padding-left: 10px;"></i>
          </div>
        </div>

        <!--侧边导航 -->
        <div id="nav" class="navfull">
          <div class="area clearfix">
            <div class="category-content" id="guide_2">

              <div class="category" >
                <ul class="category-list" id="js_climit_li" >
                    <li class="appliance js_toggle relative first" v-for="(c,index) in categoryList" :key="index" >
                      <div class="category-info">
                        <h3 class="category-name b-category-name">
                          <i><img :src="c.categoryIcon"/></i>
                          <a class="ml-22" title="点心">{{c.categoryName}}</a>
                        </h3>
                        <em>&gt;</em>
                      </div>
                      <div class="menu-item menu-in top">
                        <div class="area-in">
                          <div class="area-bg">
                            <div class="menu-srot">
                              <div class="sort-side">
                                <dl class="dl-sort" v-for="(c1,index) in c.categoryLevelList" :key="index+1">
                                  <dt><span title="蛋糕">{{c1.categoryName}}</span></dt>
                                  <dd v-for="(c2,index) in c1.categoryLevelList" :key="index+2">
                                    <a :title="c2.categoryName" href="search.html"><span>{{c2.categoryName}}</span></a>
                                  </dd>
                                </dl>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                      <b class="arrow"></b>
                    </li>
                </ul>
              </div>
            </div>

          </div>
        </div>
        <!--小导航 -->
        <div class="am-g am-g-fixed smallnav">
          <div class="am-u-sm-3">
            <a href="sort.html"><img src="../assets/images/navsmall.jpg"/>
              <div class="title">商品分类</div>
            </a>
          </div>
          <div class="am-u-sm-3">
            <a href="#"><img src="../assets/images/huismall.jpg"/>
              <div class="title">大聚惠</div>
            </a>
          </div>
          <div class="am-u-sm-3">
            <a href="#"><img src="../assets/images/mansmall.jpg"/>
              <div class="title">个人中心</div>
            </a>
          </div>
          <div class="am-u-sm-3">
            <a href="#"><img src="../assets/images/moneysmall.jpg"/>
              <div class="title">投资理财</div>
            </a>
          </div>
        </div>

        <!--走马灯 -->

        <div class="marqueen">
          <span class="marqueen-title">商城头条</span>
          <div class="demo">

            <ul>
              <li class="title-first"><a target="_blank" href="#">
                <img src="../assets/images/TJ2.jpg"/>
                <span>[特惠]</span>商城爆品1分秒
              </a></li>
              <li class="title-first"><a target="_blank" href="#">
                <span>[公告]</span>商城与广州市签署战略合作协议
                <img src="../assets/images/TJ.jpg"/>
                <p>XXXXXXXXXXXXXXXXXX</p>
              </a></li>

              <div class="mod-vip">
                <div class="m-baseinfo">
                  <a href="person/index.html">
                    <img src="../assets/images/getAvatar.do.jpg">
                  </a>
                  <em>
                    Hi,<span class="s-name">小叮当</span>
                    <a href="#"><p>点击更多优惠活动</p></a>
                  </em>
                </div>
                <div class="member-logout">
                  <a class="am-btn-warning btn" href="login.html">登录</a>
                  <a class="am-btn-warning btn" href="register.html">注册</a>
                </div>
                <div class="member-login">
                  <a href="#"><strong>0</strong>待收货</a>
                  <a href="#"><strong>0</strong>待发货</a>
                  <a href="#"><strong>0</strong>待付款</a>
                  <a href="#"><strong>0</strong>待评价</a>
                </div>
                <div class="clear"></div>
              </div>

              <li><a target="_blank" href="search.html"><span>[特惠]</span>洋河年末大促，低至两件五折</a></li>
              <li><a target="_blank" href="search.html"><span>[公告]</span>华北、华中部分地区配送延迟</a></li>
              <li><a target="_blank" href="search.html"><span>[特惠]</span>家电狂欢千亿礼券 买1送1！</a></li>

            </ul>
            <div class="advTip"><img src="../assets/images/advTip.jpg"/></div>
          </div>
        </div>
        <div class="clear"></div>
      </div>
    </div>
    <div class="shopMainbg">
      <div class="shopMain" id="shopmain">
        <!--今日推荐 -->
        <div class="am-g am-g-fixed recommendation">
          <div class="clock am-u-sm-3">
            <img src="static/images/2016.png "/>
            <p>今日<br>推荐</p>
          </div>
          <a @click="gotoTest(c.productId)" v-for="(c,index) in product" :key="index+3">
            <div class="am-u-sm-4 am-u-lg-3 ">
              <div class="info ">
                <h3>{{c.content}}</h3>
                <h4>{{c.productName}}</h4>
              </div>
              <div class="recommendationMain one">
                <img src="../assets/images/2016.png"/>
              </div>
            </div>
          </a>

        </div>
        <div class="clear "></div>
        <!--热门活动 -->

        <div class="am-container activity ">
          <div class="shopTitle ">
            <h4>活动</h4>
            <h3>每期活动 优惠享不停 </h3>
            <span class="more ">
                              <a href="#">全部活动<i class="am-icon-angle-right" style="padding-left:10px ;"></i></a>
                        </span>
          </div>
          <div class="am-g am-g-fixed ">
            <div class="am-u-sm-3 ">
              <div class="icon-sale one "></div>
              <h4>秒杀</h4>
              <div class="activityMain ">
                <img src="static/images/activity1.jpg "/>
              </div>
              <div class="info ">
                <h3>春节送礼优选</h3>
              </div>
            </div>

            <div class="am-u-sm-3 ">
              <div class="icon-sale two "></div>
              <h4>特惠</h4>
              <div class="activityMain ">
                <img src="static/images/activity2.jpg "/>
              </div>
              <div class="info ">
                <h3>春节送礼优选</h3>
              </div>
            </div>

            <div class="am-u-sm-3 ">
              <div class="icon-sale three "></div>
              <h4>团购</h4>
              <div class="activityMain ">
                <img src="static/images/activity3.jpg "/>
              </div>
              <div class="info ">
                <h3>春节送礼优选</h3>
              </div>
            </div>

            <div class="am-u-sm-3 last ">
              <div class="icon-sale "></div>
              <h4>超值</h4>
              <div class="activityMain ">
                <img src="static/images/activity.jpg "/>
              </div>
              <div class="info ">
                <h3>春节送礼优选</h3>
              </div>
            </div>

          </div>
        </div>
        <div class="clear "></div>

        <div v-for="(c,index) in categoryLevel" :key="index+6">
        <div v-if="c.categoryLevelList.length>0" :id="'f'+c.categoryId" >
          <!--甜点-->

          <div class="am-container ">
            <div class="shopTitle ">
              <h4>{{c.categoryName}}</h4>
              <h3>{{c.categorySlogan}}</h3>
              <div class="today-brands ">
                <a @click="gotoTest(c1.productId)" v-for="(c1,index) in c.categoryLevelList" :key="index+2" >
                  {{c1.productName}}
                </a>
              </div>
              <span class="more ">
                    <a href="# ">更多美味<i class="am-icon-angle-right" style="padding-left:10px ;"></i></a>
                        </span>
            </div>
          </div>

          <div class="am-g am-g-fixed floodFour">
            <div class="am-u-sm-5 am-u-md-4 text-one list ">
              <div class="word" >
                <a class="outer" @click="gotoTest(c1.productId)" v-for="(c1,index) in c.categoryLevelList" :key="index+3">
                  <span class="inner"><b class="text">{{c1.productName}}</b></span>
                </a>
              </div>
              <a href="# ">
                <div class="outer-con ">
                  <div class="title ">

                  </div>
                  <div class="sub-title ">
                    {{c.categorySlogan}}
                  </div>
                </div>
                <img src="static/images/act1.png "/>
              </a>
              <div class="triangle-topright"></div>
            </div>

              <div class="am-u-sm-7 am-u-md-4 text-two sug" v-if="c.categoryLevelList.length > 0" >
              <div class="outer-con ">
                <div class="title ">
                  {{c.categoryLevelList[0].productName}}
                </div>
                <div class="sub-title ">
                  {{c.categoryLevelList[0].content}}
                </div>
                <i class="am-icon-shopping-basket am-icon-md  seprate"></i>
              </div>
              <a href="# "><img :src="c.categoryLevelList[0].imgs[0].url"/></a>
            </div>
              <div class="am-u-sm-7 am-u-md-4 text-two" v-if="c.categoryLevelList.length > 1" >
                <div class="outer-con ">
                  <div class="title ">
                    {{c.categoryLevelList[1].productName}}
                  </div>
                  <div class="sub-title ">
                    {{c.categoryLevelList[1].content}}
                  </div>
                  <i class="am-icon-shopping-basket am-icon-md  seprate"></i>
                </div>
                <a href="# "><img src="../assets/images/01.jpg"/></a>
              </div>
              <div class="am-u-sm-3 am-u-md-2 text-three big" v-if="c.categoryLevelList.length > 2">
                <div class="outer-con ">
                  <div class="title ">
                    {{c.categoryLevelList[2].productName}}
                  </div>
                  <div class="sub-title ">
                    {{c.categoryLevelList[2].content}}
                  </div>
                  <i class="am-icon-shopping-basket am-icon-md  seprate"></i>
                </div>
                <a href="# "><img src="../assets/images/5.jpg"/></a>
              </div>
              <div class="am-u-sm-3 am-u-md-2 text-three sug" v-if="c.categoryLevelList.length > 3">
                <div class="outer-con ">
                  <div class="title ">
                    {{c.categoryLevelList[3].productName}}
                  </div>
                  <div class="sub-title ">
                    {{c.categoryLevelList[3].content}}
                  </div>
                  <i class="am-icon-shopping-basket am-icon-md  seprate"></i>
                </div>
                <a href="# "><img src="../assets/images/3.jpg"/></a>
              </div>
              <div class="am-u-sm-3 am-u-md-2 text-three " v-if="c.categoryLevelList.length > 4">
                <div class="outer-con ">
                  <div class="title ">
                    {{c.categoryLevelList[4].productName}}
                  </div>
                  <div class="sub-title ">
                    {{c.categoryLevelList[4].content}}
                  </div>
                  <i class="am-icon-shopping-basket am-icon-md  seprate"></i>
                </div>
                <a href="# "><img src="../assets/images/4.jpg"/></a>
              </div>
              <div class="am-u-sm-3 am-u-md-2 text-three last big " v-if="c.categoryLevelList.length > 5">
                <div class="outer-con ">
                  <div class="title ">
                    {{c.categoryLevelList[5].productName}}
                  </div>
                  <div class="sub-title ">
                    {{c.categoryLevelList[5].content}}
                  </div>
                  <i class="am-icon-shopping-basket am-icon-md  seprate"></i>
                </div>
                <a href="# "><img src="../assets/images/5.jpg"/></a>
              </div>

          </div>
          <div class="clear "></div>
        </div>
        </div>




        <div class="footer ">
          <div class="footer-hd ">
            <p>
              <a href="# ">锋迷商城</a>
              <b>|</b>
              <a href="# ">商城首页</a>
              <b>|</b>
              <a href="# ">支付宝</a>
              <b>|</b>
              <a href="# ">物流</a>
            </p>
          </div>
          <div class="footer-bd ">
            <p>
              <a href="# ">关于千锋</a>
              <a href="# ">合作伙伴</a>
              <a href="# ">联系我们</a>
              <a href="# ">网站地图</a>
              <em>© qfedu.com 版权所有</em>
            </p>
          </div>
        </div>

      </div>
    </div>
    <!--引导 -->
    <div class="navCir">
      <li class="active"><a href="home.html"><i class="am-icon-home "></i>首页</a></li>
      <li><a href="sort.html"><i class="am-icon-list"></i>分类</a></li>
      <li><a href="shopcart.html"><i class="am-icon-shopping-basket"></i>购物车</a></li>
      <li><a href="person/index.html"><i class="am-icon-user"></i>我的</a></li>
    </div>
    <div class=tip>
      <div id="sidebar">
        <div id="wrap">
          <div id="prof" class="item ">
            <a href="#">
              <span class="setting "></span>
            </a>
            <div class="ibar_login_box status_login ">
              <div class="avatar_box ">
                <p class="avatar_imgbox "><img src="static/images/no-img_mid_.jpg "/></p>
                <ul class="user_info ">
                  <li>用户名sl1903</li>
                  <li>级&nbsp;别普通会员</li>
                </ul>
              </div>
              <div class="login_btnbox ">
                <a href="# " class="login_order ">我的订单</a>
                <a href="# " class="login_favorite ">我的收藏</a>
              </div>
              <i class="icon_arrow_white "></i>
            </div>

          </div>
          <div id="shopCart " class="item ">
            <a href="# ">
              <span class="message "></span>
            </a>
            <p>
              购物车
            </p>
            <p class="cart_num ">0</p>
          </div>
          <div id="asset " class="item ">
            <a href="# ">
              <span class="view "></span>
            </a>
            <div class="mp_tooltip ">
              我的资产
              <i class="icon_arrow_right_black "></i>
            </div>
          </div>

          <div id="foot " class="item ">
            <a href="# ">
              <span class="zuji "></span>
            </a>
            <div class="mp_tooltip ">
              我的足迹
              <i class="icon_arrow_right_black "></i>
            </div>
          </div>

          <div id="brand " class="item ">
            <a href="#">
              <span class="wdsc "><img src="static/images/wdsc.png "/></span>
            </a>
            <div class="mp_tooltip ">
              我的收藏
              <i class="icon_arrow_right_black "></i>
            </div>
          </div>

          <div id="broadcast " class="item ">
            <a href="# ">
              <span class="chongzhi "><img src="static/images/chongzhi.png "/></span>
            </a>
            <div class="mp_tooltip ">
              我要充值
              <i class="icon_arrow_right_black "></i>
            </div>
          </div>

          <div class="quick_toggle ">
            <li class="qtitem ">
              <a href="# "><span class="kfzx "></span></a>
              <div class="mp_tooltip ">客服中心<i class="icon_arrow_right_black "></i></div>
            </li>
            <!--二维码 -->
            <li class="qtitem ">
              <a href="#none "><span class="mpbtn_qrcode "></span></a>
              <div class="mp_qrcode " style="display:none; "><img src="static/images/weixin_code_145.png "/><i
                  class="icon_arrow_white "></i></div>
            </li>
            <li class="qtitem ">
              <a href="#top " class="return_top "><span class="top "></span></a>
            </li>
          </div>

          <!--回到顶部 -->
          <div id="quick_links_pop " class="quick_links_pop hide "></div>

        </div>

      </div>
      <div id="prof-content " class="nav-content ">
        <div class="nav-con-close ">
          <i class="am-icon-angle-right am-icon-fw "></i>
        </div>
        <div>
          我
        </div>
      </div>
      <div id="shopCart-content " class="nav-content ">
        <div class="nav-con-close ">
          <i class="am-icon-angle-right am-icon-fw "></i>
        </div>
        <div>
          购物车
        </div>
      </div>
      <div id="asset-content " class="nav-content ">
        <div class="nav-con-close ">
          <i class="am-icon-angle-right am-icon-fw "></i>
        </div>
        <div>
          资产
        </div>

        <div class="ia-head-list ">
          <a href="# " target="_blank " class="pl ">
            <div class="num ">0</div>
            <div class="text ">优惠券</div>
          </a>
          <a href="# " target="_blank " class="pl ">
            <div class="num ">0</div>
            <div class="text ">红包</div>
          </a>
          <a href="# " target="_blank " class="pl money ">
            <div class="num ">￥0</div>
            <div class="text ">余额</div>
          </a>
        </div>

      </div>
      <div id="foot-content " class="nav-content ">
        <div class="nav-con-close ">
          <i class="am-icon-angle-right am-icon-fw "></i>
        </div>
        <div>
          足迹
        </div>
      </div>
      <div id="brand-content " class="nav-content ">
        <div class="nav-con-close ">
          <i class="am-icon-angle-right am-icon-fw "></i>
        </div>
        <div>
          收藏
        </div>
      </div>
      <div id="broadcast-content " class="nav-content ">
        <div class="nav-con-close ">
          <i class="am-icon-angle-right am-icon-fw "></i>
        </div>
        <div>
          充值
        </div>
      </div>
    </div>
  </div>
</template>

<script>

export default {
  name: 'Index',
  components: {
  },
  data() {
    return {
      categoryLevel:[],
      categoryList:[],
      product:[]
    }
  },
  methods: {
    gotoTest(id) {
      // 表示跳到 /test 路径对应的组件
      this.$router.push({
          path:"/Introduce",
          query:{
              productId:id
          }
      })
    }
  },
  mounted() {
    this.axios.get('http://localhost:8080/category/list').then(res=>{
      console.log(res)
      this.categoryList = res.data.data;
      console.log(this.categoryList)
    }),
    this.axios.get('http://localhost:8080/category/level').then(res=>{
      console.log(res)
      this.categoryLevel = res.data.data;
      console.log(this.categoryLevel)
    }),
    this.axios.get('http://localhost:8080/product/three')
      .then(res=>{
          this.product = res.data.data;
          console.log(this.product)
    })
  }
}
</script>

<style lang="scss" scoped>
@import '../assets/css/amazeui.css';
@import '../assets/css/admin.css';
@import '../assets/css/demo.css';
@import '../assets/css/hmstyle.css';
@import '../assets/css/skin.css';
</style>
